package com.xq.shop.controller;

import com.xq.shop.service.IMenuService;
import com.xq.shop.vo.MenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import utils.BaseResult;

import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author gaoxiaojin
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

    private final IMenuService menuService;

    @Autowired
    public MenuController(IMenuService menuService) {
        this.menuService = menuService;
    }

    @RequestMapping("/getMenuTree")
    public BaseResult<List<MenuVo>> getMenuTree() {
        BaseResult<List<MenuVo>> result = new BaseResult<>();
        List<MenuVo> voList = menuService.getMenuTree();
        result.initializeSuccess(voList);
        return result;
    }

}
